#coding:utf-8
import os
basedir = os.path.abspath(os.path.dirname(__file__))


class Config():
    DEBUG = True
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    # SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    SQLALCHEMY_RECORD_QUERIES = True
    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
        'sqlite:///' + os.path.join(basedir, 'data.sqlite')
    ARTICLES_PER_PAGE = 10
    COMMENTS_PER_PAGE = 6
    PER_PAGE = 8
    SECRET_KEY = 'secret key to protect from csrf'
    WTF_CSRF_SECRET_KEY = 'random key for form' # for csrf protection
    CSS_FRAMEWORK = 'bootstrap3'
    LINK_SIZE = 'sm'
    UPLOAD_FOLDER = '/root/gitblog/myblog/app/static/pictures/'
    THUMBNAIL_FOLDER = '/root/gitblog/myblog/app/static/pictures/thumbnail/'
    MAX_CONTENT_LENGTH = 50 * 1024 * 1024
    # decide whether or not a single page returns pagination
    SHOW_SINGLE_PAGE = False
    #去除csrf令牌验证，有令牌验证会导致ueditor无法post请求,这个是去掉所有的csrf验证，并不可取，默认情况下是开启的。之后有正确地处理方式。
    #WTF_CSRF_CHECK_DEFAULT = False
    # Take good care of 'SECRET_KEY' and 'WTF_CSRF_SECRET_KEY', if you use the
    # bootstrap extension to create a form, it is Ok to use 'SECRET_KEY',
    # but when you use tha style like '{{ form.name.labey }}:{{ form.name() }}',
    # you must do this for yourself to use the wtf, more about this, you can
    # take a reference to the book <<Flask Framework Cookbook>>.
    # But the book only have the version of English.

    @staticmethod
    def init_app(app):
        pass

